package com.control.thread;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.control.model.Cooker;
public final class ManagerCollectionUtils {
	
	public static final int maxMsgNum = 10;
	
	private static Map<String, AcceptClientMsgThread> acceptClientMap = new HashMap<String,AcceptClientMsgThread>();
	
	private static Map<Long,Cooker> cookerMap = new HashMap<Long, Cooker>();
	
	
	public static Map<Long, Cooker> getCookerMap() {
		return cookerMap;
	}
	
	public static Cooker getCooker(Long threadId){
		return cookerMap.get(threadId);
	}

	public static void setCookerMap(Long threadId,Cooker cooker) {
		cookerMap.put(threadId, cooker);
	}
	
	public static void removeCooker(String threadId){
		cookerMap.remove(threadId);
	}

	public static void addClientThread(String uid,AcceptClientMsgThread ct){
		acceptClientMap.put(uid, ct);
	}
	
	public static AcceptClientMsgThread getClientThread(String uid){
		return acceptClientMap.get(uid);
	}
	
	public static Map<String, AcceptClientMsgThread> getAllClientThread(){
		return acceptClientMap;
	}
	
	
	public static void removeClientThread(String uid){
		acceptClientMap.remove(uid);
	}
	
	public static String getALLClientCode(){
		Iterator it = acceptClientMap.keySet().iterator();
		StringBuffer sb = new StringBuffer(1000);
		while(it.hasNext()){
			sb.append(it.next().toString()+",");
		}
		return sb.toString();
	}
	
}
